var __extends =
    (this && this.__extends) ||
    (function () {
      var e = function (t, n) {
        return (e =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (e, t) {
              e.__proto__ = t;
            }) ||
          function (e, t) {
            for (var n in t)
              Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
          })(t, n);
      };
      return function (t, n) {
        function a() {
          this.constructor = t;
        }
        if ("function" != typeof n && null !== n)
          throw new TypeError(
            "Class extends value " + String(n) + " is not a constructor or null"
          );
        e(t, n),
          (t.prototype =
            null === n
              ? Object.create(n)
              : ((a.prototype = n.prototype), new a()));
      };
    })(),
  AddSkillCountView = (function (e) {
    function t() {
      var t = e.call(this) || this;
      return (
        (t.lvl = 3),
        t.tab_lvl.on(Laya.Event.CLICK, t, t.onTabDidClickItem),
        t.btn_back.on(Laya.Event.CLICK, t, t.onCancleFn),
        (t.list_skill.vScrollBarSkin = ""),
        (t.list_skill.selectEnable = !0),
        t.list_skill.on(Laya.Event.CLICK, t, t.onListDidClickFn),
        WebSocketService.addListener({
          caller: t,
          code: 4120,
          method: t.onLoadData,
        }),
        WebSocketService.addListener({
          caller: t,
          code: 4122,
          method: t.onLoadLearn,
        }),
        t
      );
    }
    return (
      __extends(t, e),
      (t.open = function () {
        null == this.instance && (this.instance = new t()),
          WebSocketService.send({ c: 4120, d: { lvl: 3 } }),
          this.instance.pos(0, 0),
          (this.instance.tab_lvl.selectedIndex = 0),
          Laya.stage.addChild(this.instance);
      }),
      (t.isThisNpc = function (e) {
        return 6009 == e;
      }),
      (t.prototype.onTabDidClickItem = function (e) {
        var t = 0;
        "item0" == e.target.name
          ? (t = 3)
          : "item1" == e.target.name
          ? (t = 4)
          : "item2" == e.target.name
          ? (t = 5)
          : "item3" == e.target.name && (t = 6),
          (this.lvl = t),
          WebSocketService.send({ c: 4120, d: { lvl: t } });
      }),
      (t.prototype.onLoadData = function (e) {
        if (0 == e.code) {
          for (var t = [], n = e.data, a = 0; a < n.length; a++) {
            var i = n[a],
              o = {
                cid: i.cid,
                skillId: i.id,
                label_name: { text: i.cname },
                label_lvl: { text: i.lvl + "级" },
                label_skill: { text: i.name },
                label_hua: { text: 1 == i.hua ? "化" : "" },
                label_count: { text: i.num },
              };
            t.push(o);
          }
          this.list_skill.array = t;
        } else ToastView.toastView(e.msg);
      }),
      (t.prototype.onListDidClickFn = function (e) {
        if ("" != e.target.name && "btn_learn" == e.target.name) {
          var t = e.target.parent.dataSource;
          WebSocketService.send({ c: 4122, d: { cid: t.cid, sid: t.skillId } });
        }
      }),
      (t.prototype.onLoadLearn = function (e) {
        ToastView.toastView(e.msg),
          0 == e.code &&
            (WebSocketService.send({ c: 4120, d: { lvl: this.lvl } }),
            Laya.stage.event("GameMainView", "refreshMoney"),
            Laya.stage.event("HomePageView", "refreshMoney"));
      }),
      (t.prototype.onCancleFn = function () {
        this.removeSelf();
      }),
      t
    );
  })(ui.ActivityController.AddSkillCountViewUI);
